﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace Deepseek_Robot.Modules.Utils
{
    public class DoubaoAPI
    {
        public async IAsyncEnumerable<string> CallApi(string prompt)
        {
            // 替换为你的火山引擎 API Key 和 Secret Key
            string apiKey = "8ab58837-117f-4f38-b072-1bea409f0018";
            string secretKey = "WWpVek0ySm1aVGd3WTJVeE5EWmlPRGt5WldRME5tRTNPVGhoWXpWallXVQ==";
            string EndpointId = "ep-20250212111838-cjvzv"; //Doubao-1.5-pro-32k
            string config = "{ \"Url\": \"https://ark.cn-beijing.volces.com/api/v3/chat/completions\", \"ApiKey\": \"8ab58837-117f-4f38-b072-1bea409f0018\", \"EndpointId\": \"ep-20250212111838-cjvzv\" }";
            TyClient Client = new TyModel(config);
            await foreach (var chunk in Client.ChatAIAsync(prompt))
            {
                yield return chunk;
            }
        }
    }
}
